<?php 
namespace app\common\model\shop;

use think\Model;

class ShopGoods extends Model
{
	protected function setGoodsCarouselAttr($v)
	{
		return json_encode($v);
	}
	protected function setAttrsAttr($v)
	{
		return json_encode($v);
	}
	
	protected function setRetailAttr($v)
	{
		return json_encode($v);
	}
	
	protected function setIsRetailAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function setIsHotAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function setIsRecommonedAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function setIsSeasonAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function setIsChoiseAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function setIsIntergalAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getAttrsAttr($v)
	{
		return json_decode($v,true);
	}
	protected function getIsRetailAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getIsHotAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getIsRecommonedAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getIsSeasonAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getIsChoiseAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getIsIntergalAttr($v)
	{
		return $v ? 1 : 0;
	}
	protected function getGoodsImgAttr($v)
	{
		return 'http://'.$_SERVER['HTTP_HOST'].$v;
	}
	protected function getGoodsCarouselAttr($v)
	{
		$list = json_decode($v,true);
		foreach ($list as &$rows) {
			$rows = 'http://'.$_SERVER['HTTP_HOST'].$rows;
		}
		return $list;
	}
	protected function getSizeIndexAttr($v)
	{
		return json_decode($v,true);
	}
	protected function getSizeContentAttr($v)
	{
		return json_decode($v,true);
	}
	protected function getDeleteTimeAttr($v)
	{
		return date('Y-m-d H:i:s',$v);
	}
}